/*
 * This computer program is the confidential information and proprietary trade
 * secret of Apptonelabs, Inc. Possessions and use of this program must
 * conform strictly to the license agreement between the user and
 * Apptonelabs, Inc., and receipt or possession does not convey any rights
 * to divulge, reproduce, or allow others to use this program without specific
 * written authorization of Apptonelabs, Inc.
 * 
 * Copyright (c) 2012-2015 Apptonelabs, Inc. All Rights Reserved.
 */
package com.apptonelabs.vnc.vphone;

import java.io.DataOutput;
import java.io.IOException;

public class RecordOutputStream implements DataOutput {

	public RecordOutputStream(RfbProto rfbproto) {
		rfb = rfbproto;
	}

	private boolean canWrite() {
		return ((rfb != null) && (rfb.rec != null));
	}

	public void write(byte[] b) throws IOException {
		if (canWrite())
			rfb.rec.write(b);
	}

	public void write(byte[] b, int off, int len) throws IOException {
		if (canWrite())
			rfb.rec.write(b, off, len);
	}

	public void write(int b) throws IOException {
		if (canWrite())
			rfb.rec.writeIntBE(b);
	}

	public void writeBoolean(boolean v) {
	}

	public void writeByte(int v) throws IOException {
		if (canWrite()) {
			rfb.rec.writeByte(v);
		}
	}

	public void writeBytes(String s) {
	}

	public void writeChar(int v) {
	}

	public void writeChars(String s) {
	}

	public void writeDouble(double v) {
	}

	public void writeFloat(float v) {
	}

	public void writeInt(int v) throws IOException {
		if (canWrite())
			rfb.rec.writeIntBE(v);
	}

	public void writeLong(long v) {
	}

	public void writeShort(int v) throws IOException {
		if (canWrite())
			rfb.rec.writeShortBE(v);
	}

	public void writeUTF(String str) {
	}

	private RfbProto rfb = null;
}
